package com.yunhe.energy.client.fallback;

import com.yunhe.energy.client.MeasHistoryClient;
import com.yunhe.common.model.ResultObject;
import com.yunhe.common.model.data.MeasurePointMap;
import com.yunhe.common.model.data.Measurement;
import com.yunhe.common.util.FallbackUtil;
import feign.hystrix.FallbackFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author liuronglei
 */
@Component
public class MeasHistoryFallbackFactory implements FallbackFactory<MeasHistoryClient> {
    @Override
    public MeasHistoryClient create(Throwable arg0) {
        return new MeasHistoryClient() {


            @Override
            public ResponseEntity<ResultObject<List<Measurement>>> getMeasurements(Long pointNumber, List<Date> dtime, Map<String, Object> pageParam) {
                return null;
            }

            @Override
            public ResponseEntity<ResultObject<Double>> getPreValue(Long pointNumber) {
                return FallbackUtil.getDefaultFallBack();
            }
        };
    }
}
